#!/usr/bin/perl -w
use lib("./cairolib");
use strict;
use cairolib::linegraph;
use cairolib::bargraph;

sub linegraph
{
   my %data;
   $data{1} = 2;
   $data{2} = 3;
   $data{3} = 4;
   $data{12.5} = 12.5;

   my $graph = new cairolib::linegraph(600, 400);


   $graph->addDataSet(\%data, "one", "#FF9900");

   %data = ();
   $data{1} = 12;
   $data{2} = 4;
   $data{3} = 15;
   $data{15.5} = 6;
   $graph->addDataSet(\%data, "two", "#C0C0C0");

   $graph->setXAxis("x-axis", "#FF9900", 0, 30, 1);
   $graph->setYAxis("y-axis", "#343434", 0, 30, 1);

   print $graph->drawGraph("tmp.png");
}

sub bargraph
{
   my %data;
   $data{1} = 2;
   $data{2} = 3;
   $data{3} = 4;
   $data{4.6} = 12.5;

   my $graph = new cairolib::bargraph(600, 400);

   $graph->addDataSet(\%data, "one", "#FF9900");

   %data = ();
   $data{1} = 12;
   $data{2} = 4;
   $data{3} = 15;
   $data{5} = 6;
   $graph->addDataSet(\%data, "two", "#C0C0C0");

   $graph->setXAxis("x-axis", "#FF9900", 0, 30, 1);
   $graph->setYAxis("y-axis", "#343434", 0, 30, 1);

   $graph->drawGraph("tmp.png");
}


bargraph();
